<?php template('header')?>

<div id="content">
<div class="post archives">

<h3><?php echo '文章归档';?></h3>

<?php if ( !$get['date'] ) : ?>
<p>

<?php foreach ( $archives as $year => $months ) : ?>
<h4><a href="<?php echo url('mod=archives&date='.$year)?>"><?php echo $year ?>年</a></h4>
<ul>
	<?php
		foreach ( $months as $month => $num ) {
			echo '<li><a href="'.url("mod=archives&date={$year}-{$month}").'">'.$year.'年'.$month.'月</a> ('.$num.')</li>';
		}
	?>
</ul>

<?php endforeach; ?>

</p>
<?php else : ?>

<h4>
<?php 
if ( $year ) {
	echo "{$year}年";
	if ( $month ) {
		echo "{$month}月";
	}
	if ( $day ) {
		echo "{$day}日";
	}
}
?>
</h4>
<?php foreach ( $archives as $post ) : ?>
<p>
	<ul>
		<li>[<?php echo $post['category']; ?>] <a href="<?php echo $post['url']?>"><?php echo $post['title']?></a> <span style="color:gray">(<?php echo $post['posttime']?>, <?php echo $post['views']?>次阅读, <?php echo $post['comments']?>条评论)</span></li>
	</ul>
</p>
<?php endforeach; ?>

<?php echo showpage();?>


<?php endif; ?>

</div>
</div>

<?php template('sidebar')?>

<?php template('footer')?>